Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Semigroup (Predicate a) instance #39

Merged
merged 1 commit into from
Jan 8, 2018
Merged

Conversation

phadej
Copy link
Contributor

@phadej phadej commented Jan 7, 2018

Fixes #38

Copy link
Collaborator

@RyanGlScott RyanGlScott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM besides one quibble about CPP usage.

@@ -310,9 +310,18 @@ newtype Predicate a = Predicate { getPredicate :: a -> Bool }
instance Contravariant Predicate where
contramap f g = Predicate $ getPredicate g . f

#if defined(MIN_VERSION_semigroups) || __GLASGOW_HASKELL__ >= 711
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use MIN_VERSION_base(4,9,0) instead of __GLASGOW_HASKELL__ >= 711.

instance Monoid (Predicate a) where
mempty = Predicate $ const True
#if defined(MIN_VERSION_semigroups) || __GLASGOW_HASKELL__ >= 711
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@phadej
Copy link
Contributor Author

phadej commented Jan 7, 2018 via email

@RyanGlScott
Copy link
Collaborator

I copied the CPP conditional from other parts of the file

Ah, fair enough. I (personally) believe we should eschew this use of __GLASGOW_HASKELL__ to implicitly represent base bounds. If you feel motivated to convert the other sketchy uses of __GLASGOW_HASKELL__ as well, that would be nice, but if not, I can do it myself after merging.

@phadej phadej mentioned this pull request Jan 8, 2018
27 tasks
@phadej
Copy link
Contributor Author

phadej commented Jan 8, 2018

Yes, let's use MIN_VERSION_base, it's more correct (as that's is really base issue).

Let's merge this, and do refactoring later.

@RyanGlScott RyanGlScott merged commit d9bac20 into ekmett:master Jan 8, 2018
@phadej phadej deleted the smp branch January 8, 2018 15:54
RyanGlScott added a commit that referenced this pull request Jan 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants